<template>
	<view class="u-page">
		<view class="header">
		</view>
		<view class="content">
			<view class="projectList" >
				<view class="label">{{title}}</view>
				<view  v-if="lists != ''">
					<block v-for="(item, index) in lists" :key="index">
						<view class="lists" @click="files(item)">
							<view class="filename"><image src="../../../static/icon/folder.png" mode=""></image></view>
							<view class="list_contnet">
								<view class="projecttitle">{{item.folderName}}</view>
								<view class="folderinfo">{{item.folderinfo}}</view>
							</view>
							<view class="more">
								<image src="../../../static/icon/more.png" mode=""></image>
							</view>
							
						</view>
					</block>
				</view>
				<view class="zanwu" v-else>
					<view>暂无文件资料</view>
				</view>
			</view>
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pid:'',
				title:'',
				lists: [],
				
			}
		},
		onLoad(data) {
			this.pid = data.id
			
			console.log('1',this.pid)
			this.filesList();
		},
		methods: {
			async filesList(){
				const project = await this.GQL({
					"operationName": "allSlProjects",
					"query": "query allSlProjects($filter: SlProjectFilter) { allSlProjects(filter:$filter) { nodes { pid title } } }",
					"variables": {"filter": {"pid":{"equalTo":this.pid}}}
				})
				if(project.data.allSlProjects.nodes !=''){
					this.title = project.data.allSlProjects.nodes[0].title
				}
				
				const files = await this.GQL({
					"operationName": "allSlProjectFolders",
					"query": "query allSlProjectFolders($filter: SlProjectFolderFilter) { allSlProjectFolders(filter:$filter) { nodes { id pid folderName folderinfo } } }",
					"variables": {"filter": {"pid":{"equalTo":this.pid}}}
				})
				if(files.data.allSlProjectFolders.nodes !=''){
					
					this.lists = files.data.allSlProjectFolders.nodes
				}
			},
			files(item){
				uni.navigateTo({
					url:"/pages/project/investment/projectFiles?id="+item.id+"&title="+item.folderName
				})
			},
		}
	}
</script>

<style lang="scss">
.u-page{
		background-color: #FBFCFE;
	}
	 .header{
	 	width: 100%;
	 	height: 200px;
	 	/* color: #FFFFFF; */
	 	background: linear-gradient(#C7171E, #f0f2f5); /* 标准的语法 */
	 	
	 }
	 .zanwu{
		 font-size: 14px;
		 font-family: PingFangSC-Medium, PingFang SC;
		 font-weight: 500;
		 color: #9BA7C1;
		 line-height: 16px;
		 margin: 10px;
		 padding-top: 10px;
	 }
	.content{
		position: relative;
		top: -200px;
		
		margin: 15px;
		.label{
			font-size: 16px;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 600;
			color: #161E3E;
			line-height: 16px;
			margin: 10rpx;
			padding: 24rpx 16rpx;
		}
		.projectList{
			background-color: #FFFFFF;
			border-radius: 5px;
			min-height: 500px;
			.lists{
				margin: 6px 10px;
				display: flex;
				align-items: center;
				height: 50px;
			}
			.list_contnet{
				width: 200px;
				margin-left: 10px;
				flex: 1;
			
			}
			.filename{
				font-size: 12px;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				font-size: 15px;
				color: #161E3E;
				line-height: 16px;
			}
			.folderinfo{
				font-size: 12px;
				color: #9BA7C1;
				line-height: 12px;
			}
			.more{
				width: 5%;
				image{
					width: 15px;
					// margin-top: 15px;
					height: 15px;
				}
			}
			
			image{
				width:46px;
				height:36px;
			}
			
		}	
		.upFiles{
			margin-top: 20px;
		}
		
	}
	
</style>
